<?php

namespace App\Admin\Controllers;

use App\Models\VipCategory;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Controllers\AdminController;

class VipCategoriesController extends AdminController
{
    protected $title = 'VIP分类';
    
    protected function grid()
    {
        $grid = new Grid(new VipCategory());
	
	    $grid->disableExport();
	    
	    $grid->column('name', 'VIP分类名称');
	    $grid->column('day', 'VIP购买天数');
	    $grid->column('price_market', '购买VIP市场价格');
	    $grid->column('price_lowest', '购买VIP实际价格');
	    $grid->column('price_brokerage', '分佣金额');
	    $grid->column('created_at', '创建时间')->display(function () {
	    	return $this->created_at->toDatetimeString();
	    });
        return $grid;
    }
    
    protected function detail($id)
    {
        $show = new Show(VipCategory::findOrFail($id));



        return $show;
    }
    
    protected function form()
    {
        $form = new Form(new VipCategory());
	    $form->text('name', 'VIP分类名称');
	    $form->text('day', 'VIP购买天数');
	    $form->currency('price_market', '购买VIP市场价格')->symbol('￥')->default(0);
	    $form->currency('price_lowest', '购买VIP实际价格')->symbol('￥')->default(0);
	    $form->currency('price_brokerage', '分佣金额')->symbol('￥')->default(0);
	   

        return $form;
    }

}
